package com.example.leetdemo.finash;

import java.util.ArrayList;
import java.util.List;

public class Solution728 {

    public List<Integer> selfDividingNumbers(int left, int right) {
        List<Integer> list = new ArrayList<>();
        for (int i = left; i <= right; i++) {
            int tem = i;
            while (tem > 0) {
                int p = tem % 10;
                if (p == 0) {
                    break;
                } else if (i % p != 0) {
                    break;
                }
                if (tem < 10) {
                    list.add(i);
                    break;
                }
                tem = tem / 10;
            }
        }
        return list;
    }

    public static void main(String[] args) {
        Solution728 solution728 = new Solution728();
        System.err.println(solution728.selfDividingNumbers(0, 100));
    }
}
